package com.example.designpattenexample.proxy;

//代理主题
public class ProxySubject implements Subject {
    private Subject subject;

    public ProxySubject(Subject subject){
        this.subject = subject;
    }

    @Override
    public void request() {
        this.beforeRequest();
        this.subject.request();
        this.afterRequest();
    }

    private void beforeRequest(){
        //预处理
        System.out.println("proxy before request");
    }

    private void afterRequest(){
        //后处理
        System.out.println("proxy after request");
    }

}
